/**
 * 4
 *  
 * @Author : Ruoyu Wang
 * @DateTime : 24-9-22 下午6:59
 */

#include <iostream>
#include <vector>
using namespace std;

const int MOD = 1e9 + 7;

int main() {
    int n;
    cin >> n;
    vector<int> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    vector<long long> dp(n, 1);

    long long res = 0;

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < i; ++j) {
            if (a[j] > a[i]) {
                dp[i] = (dp[i] + dp[j]) % MOD;
            }
        }
        res = (res + dp[i]) % MOD;
    }

    cout << res << endl;
    return 0;
}


